load("//bazel:mongo_src_rules.bzl", "mongo_cc_library", "mongo_cc_unit_test")

package(default_visibility = ["//visibility:public"])

exports_files(
    glob([
        "*.h",
        "*.cpp",
    ]),
)

# Core definitions: ABT, Logical and physical properties, Metadata, and core
# utilities.
mongo_cc_library(
    name = "optimizer_base",
    srcs = [
        "defs.cpp",
        "explain.cpp",
        "reference_tracker.cpp",
        "//src/mongo/db/query/optimizer/syntax:expr.cpp",
    ],
    hdrs = [
        "defs.h",
        "explain.h",
        "reference_tracker.h",
        "strong_alias.h",
        "//src/mongo/db/query/optimizer:comparison_op.h",
        "//src/mongo/db/query/optimizer:containers.h",
        "//src/mongo/db/query/optimizer/syntax:expr.h",
        "//src/mongo/db/query/optimizer/syntax:syntax.h",
        "//src/mongo/db/query/optimizer/syntax:syntax_fwd_declare.h",
    ],
    deps = [
        # We should only depend on SBE for value representation and basic
        # arithmetic for constant folding.
        "//src/mongo/db/exec/sbe:query_sbe_makeobj_spec",
        "//src/mongo/db:sbe_values",  # TODO(SERVER-93876): Remove.
    ],
)

mongo_cc_unit_test(
    name = "optimizer_test",
    srcs = [
        "reference_tracker_test.cpp",
    ],
    tags = ["mongo_unittest_second_group"],
    deps = [
        "//src/mongo/db/exec/sbe:abt_unit_test_utils",
        "//src/mongo/db/exec/sbe:query_sbe",  # needed to register extended type destruction for MakeObjSpec :(
    ],
)
